package org.example;

public class 第五章_变量类型 {
    public static void main(String[] args) {
        RunoobTest runoobTest = new RunoobTest();
        runoobTest.method(50);

        RunoobTest runoobTest1 = new RunoobTest();
        RunoobTest runoobTest2 = new RunoobTest();
        RunoobTest runoobTest3 = new RunoobTest();
        System.out.println("目前为止创建的对象数: " + RunoobTest.count);
    }

    static class RunoobTest{

        //计数器
        public static int count;
        //成员变量
        private int instanceVar;
        //静态变量
        private static int staticVar;
        //构造函数
        public RunoobTest(){
            count++;
        }

        public void method(int paramVar){
            //局部变量
            int localVar = 10;

            // 使用变量
            instanceVar = localVar;
            staticVar = paramVar;

            System.out.println("成员变量: " + instanceVar);
            System.out.println("静态变量: " + staticVar);
            System.out.println("参数变量: " + paramVar);
            System.out.println("局部变量: " + localVar);
        }
    }
}
